<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>简单查询</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	
	<style type="text/css">
		#xuexiao{
			color:#555;
		}
		#xuexiao:hover{
			color:#3a87ad;
		}
	</style>
</head>
<body >
		<%@include file="include/topbar.jsp" %>
		
		<div class="container" style="margin-top: 60px">
			<div class="row">
			<jsp:include page="include/left.jsp" >
				<jsp:param value="jingque" name="tag"/>
			</jsp:include>
				
			
			<div class="span9" style="min-height:500px">
				<div class="breadcrumb" style="border-radius:3px 3px 0 0;margin-bottom:0px;">
        				<h4 style="display:inline"><i class="icon-screenshot"></i>简单查询</h4>

        				
     			</div>
     			
     			
     			<div class="wall" style="padding:20px 30px;min-height:350px">
     			
     				<div class="page-header " style="margin-top:0px" >
						<select class="span2" style="margin-bottom:-0px" id="s1">
							<option value="name">题名/关键字</option>
							<option value="author">作者</option>
							<option value="qikan">刊名</option>
							<option value="type">分类</option>
							
							<option value="id">ISSN/日期</option>
						</select>
						<select class="span1" id="s2" style="margin-bottom:0px">
							<option value="mohu">模糊</option>
							<option value="jingque">精确</option>
						</select>
						<input  type="text" data-source='${namelist }' data-items="10" data-provide="typeahead" style="margin: 0 auto;" class="span4 typeahead shuru"/>
						
						&nbsp;&nbsp;&nbsp;<button class="btn btn-primary" id="search"><i class="icon-search icon-white"></i>查询</button>
				  	</div>
     				
        			
        			
     				<table class="table table-striped table-bordered table-condensed" >
  						<thead>
  							<tr>
  								<th>文献编号</th>
  								<th>文献名</th>
  								<th>作者</th>
  								<th>分类</th>
  								<th>期刊</th>
  								<c:if test="${user.role eq 'admin' }">
  								<th id="caozuo">操作</th>
  								</c:if>
  								
  							</tr>
  						</thead>
  						<tbody id="reslut">
  							
  								
  							
  						</tbody>
					</table>
					
     			</div>
     			
			</div>	
			
			
			</div>
			</div>
			<%@include file="include/footer.jsp" %>
			
											
											
											
											 <div class="modal fade" id="del">
												   <div class="modal-header">
	    												<a class="close" data-dismiss="modal">×</a>
												    	<h4>系统提示</h4>
												    </div>
												    <div class="modal-body" style="text-align:center">
												   		<h4>确定要删除此文献么？</h4>
												    </div>
													<div class="modal-footer">
												    <a href="javascript:;" class="btn" data-dismiss="modal">返回</a>
												    <a href="#" class="btn btn-primary" id="btn-del">确认删除</a>
												    </div>
											</div>

			<script type="text/javascript">
				 $(document).ready(function(){
					$("#search").click(function(){
						$("tbody").text("");
						var da = $(".shuru").val().trim();
						
						var tag = $("#s1").val();
						var mj = $("#s2").val();
						if(da == ""){
							alert("输入框不能为空！");
						}else{
							$.ajax({
								url:"jingque.jspx",
								type:"POST",
								data:{data:da,tag:tag,mj:mj},
								success:function(json){
									$(json).each(function(){
										var tr=$("<tr>");
										var td1 = $("<td>").text(this.id);
										var name = this.name;
										var td2 = $("<td><a href='wxdetail.jspx?wid="+this.id+"'>"+name+"</a></td>");
										var td3 = $("<td width='10%'>"+this.author+"</td>");
										var td4 = $("<td>"+this.type_name+"</td>");
										var td5 = $("<td>"+this.qikan_name+"</td>");
										
										
										var a1 =$("<a href='editwenxian.jspx?wid="+this.id+"' title='修改文献' ><i class='icon-edit'></i></a>");
										var a2 = $("<a href='#del' title='删除文献' data-toggle='modal' rel='"+this.id+"' ><i class='icon-trash'></i></a>");
										var td6 =$("<td width='7%'></td>");
										a1.appendTo(td6);
										a2.click(shanchu).appendTo(td6);
										td1.appendTo(tr);
										td2.appendTo(tr);
										td3.appendTo(tr);
										td4.appendTo(tr);
										td5.appendTo(tr);
										var b=$("th[id]").attr("id");
										if(b =="caozuo"){
											td6.appendTo(tr);
										}
										
										tr.appendTo($("tbody"));
									});
								}
							});
						}
					});
					
					
					$("#s1").change(function(){
						
						$(".shuru").val("");
						
					});
					
					function shanchu(){
						var id = $(this).attr("rel");
						
						$("#btn-del").attr("href","delwenxian.jspx?wid="+id);
					}
				
				}); 
			</script>
	
</body>
</html>